Namespace Helpers

    Public Class UIHelper

        Public Shared Function DeletionConfirmed(ByVal message As String) As Boolean
            Dim dialog As New ConfirmDialog(ConfirmDialog.ConfirmDialogType.ConfirmDeletion, message)
            Return (dialog.ShowDialog() = DialogResult.OK)
        End Function

        Public Shared Function WarningConfirmed(ByVal message As String) As Boolean
            Dim dialog As New ConfirmDialog(ConfirmDialog.ConfirmDialogType.ConfirmWarning, message)
            Return (dialog.ShowDialog() = DialogResult.OK)
        End Function

        Public Shared Sub ResolveTabPage(ByVal tabContainer As TabControl, ByVal form As Form, ByVal tabPageName As String, ByVal tabPageText As String)

            If Not tabContainer.TabPages.ContainsKey(tabPageName) Then

                Dim tabPage As New TabPage(String.Format("{0}    ", tabPageText))
                tabPage.Name = tabPageName

                tabContainer.TabPages.Add(tabPage)
                tabContainer.TabPages(tabPageName).Controls.Add(form)

            End If

            tabContainer.SelectedTab = tabContainer.TabPages(tabPageName)

        End Sub

        Public Shared Sub LoadExistingTabPage(ByVal tabContainer As TabControl, ByVal form As Form, ByVal tabPageName As String)

            If tabContainer.TabPages.ContainsKey(tabPageName) Then

                tabContainer.TabPages(tabPageName).Controls.Clear()
                tabContainer.TabPages(tabPageName).Controls.Add(form)

            End If

        End Sub

        Public Shared Sub RedirectToTabPage(ByVal tabContainer As TabControl, ByVal tabPageName As String)

            If tabContainer.TabPages.ContainsKey(tabPageName) Then

                tabContainer.SelectedTab = tabContainer.TabPages(tabPageName)

            End If

        End Sub

    End Class

End Namespace
